package day20;

public class TestDaemon {
	private volatile int i = 10;
	public static void main(String[] args) {
		Thread t1 = new Thread2();
		Thread t2 = new DaemonThread();
		t2.setDaemon(true);
		t1.start();
		t2.start();
	}
}

class Thread2 extends Thread {
	public void run() {
		for (int i = 1; i <= 100; i++) {
			System.out.print(i + " ");
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}

class DaemonThread extends Thread {
	public void run() {
		/*Thread t = new Thread2();
		t.start();*/
		while (true) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println();
		}
	}
}
